package com.wing.res.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wing.res.model.entity.BenchmarkBook;
import com.wing.res.model.entity.ReceiptRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 领料记录-Dao
 *
 * @author xiayang
 */
@Mapper
public interface ReceiptRecordDao extends BaseMapper<ReceiptRecord> {

    /**
     * 分页列表
     *
     * @param page
     * @param params
     * @return
     */
    List<ReceiptRecord> list(@Param("page") Page<ReceiptRecord> page, @Param("params") Map<String, Object> params);


    /**
     * 领料记录详情
     *
     * @param params 领料记录参数
     * @return
     */
    ReceiptRecord get(@Param("params") Map<String, Object> params);

    /**
     * 修改领取个数
     * @param workOrderId 开工单id
     * @param getQuantity 本次领取个数
     * @return
     */
    boolean updateWorkInfoBy(@Param("workOrderId") Long workOrderId,@Param("getQuantity") Integer getQuantity);

    /**
     * 获取上一道工序的id
     * @param workOrderId
     * @return
     */
    Map<String,Object> getUpWorkInfoBy(@Param("workOrderId") Long workOrderId);

    /**
     * 修改数量
     * @param id orderId
     * @param num 可领取数量
     */
    int updateWorkForCanGetQuaBy(@Param("id") Long id,@Param("num") Integer num);
}
